﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;

namespace LowLevelGraphics.ImageFormats.SVG.Shapes
{
    /// <summary>
    /// 
    /// </summary>
    public class Line : Shape
    {
        protected float m_nX2 = -1;
        protected float m_nY2 = -1;

        /// <summary>
        /// Initializes a new instance of the <see cref="Line"/> class.
        /// </summary>
        public Line()
        {
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="Line"/> class.
        /// </summary>
        /// <param name="x1">The x1.</param>
        /// <param name="y1">The y1.</param>
        /// <param name="x2">The x2.</param>
        /// <param name="y2">The y2.</param>
        public Line(float x1, float y1, float x2, float y2)
        {
            this.Location = new PointF(x1, y1);
            this.m_nX2 = x2;
            this.m_nY2 = y2;
        }

        /// <summary>
        /// Draws the specified g.
        /// </summary>
        /// <param name="g">The g.</param>
        public override void Draw(Graphics g)
        {
            Color color = Style.StrokeColor;
            Pen pen = new Pen(new SolidBrush(color));
            pen.LineJoin = Style.LineJoin;
            pen.StartCap = Style.LineCap;
            pen.MiterLimit = Style.Miterlimit;
            g.DrawLine(pen, this.Location.X, this.Location.Y, m_nX2, m_nY2);
            pen.Dispose();
        }
    }
}
